home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 4 / MacFormat n. 4 (Spain) / MacFormat 4.bin / Demos / DiscoverIndia Demo / RUrban.dir / 00115.ls < prev    next >
Encoding:
Text File  |  1995-03-29  |  5.1 KB  |  218 lines

  1. on startMovie
  2.   setCsrs()
  3. end
  4.  
  5. on stepMovie
  6.   if not rollOver(24) then
  7.     exit
  8.   end if
  9.   puppetSprite(24, 1)
  10.   set the castNum of sprite 24 to the number of cast "Redhand"
  11.   updateStage()
  12.   set exitFlag to 0
  13.   repeat while rollOver(24)
  14.     if the mouseDown then
  15.       if soundBusy(1) then
  16.         sound fadeOut 1, 2 * 60
  17.       end if
  18.       set exitFlag to 1
  19.       exit repeat
  20.     end if
  21.   end repeat
  22.   if exitFlag then
  23.     go("QuitReturnPlusOne", "Shiva.dir")
  24.   else
  25.     set the castNum of sprite 24 to the number of cast "Whitehand"
  26.     puppetSprite(24, 0)
  27.   end if
  28. end
  29.  
  30. on init
  31.   global gameCount, csr131
  32.   repeat with chan = 2 to 7
  33.     puppetSprite(chan, 1, )
  34.   end repeat
  35.   repeat with chan = 9 to 16
  36.     puppetSprite(chan, 1, )
  37.     set the cursor of sprite chan to csr131
  38.   end repeat
  39.   set the cursor of sprite 8 to csr131
  40.   repeat with i = 1 to 24
  41.     put "N" into line i of field "Done List"
  42.   end repeat
  43.   set gameCount to 0
  44.   puppetSprite(17, 1)
  45.   puppetSprite(18, 1)
  46.   put " " into field "Rural Text"
  47.   put " " into field "Urban Text"
  48. end
  49.  
  50. on showCard
  51.   global uCard, rCard, uCardi, rCardi, matchedCount, whichCard
  52.   puppetSound("Bubble Gum Pop")
  53.   set whichSprite to the clickOn
  54.   set whichCard to the clickOn - 8
  55.   if item 1 of line whichCard of field "Card Table" = "Y" then
  56.     beep()
  57.     exit
  58.   else
  59.     if whichCard < 5 then
  60.       turnCardBack("R")
  61.     else
  62.       turnCardBack("U")
  63.     end if
  64.   end if
  65.   set whichCast to "CARD" & item 2 of line whichCard of field "Card Table"
  66.   set the castNum of sprite whichSprite to the number of cast whichCast
  67.   if whichCard < 5 then
  68.     set rCard to whichCast
  69.     set rCardi to whichCard
  70.   else
  71.     set uCard to whichCast
  72.     set uCardi to whichCard
  73.   end if
  74.   setUpText()
  75.   updateStage()
  76.   if uCard = rCard then
  77.     puppetSound("Indian Bell Very Soft")
  78.     put "Y" into item 1 of line uCardi of field "Card Table"
  79.     put "Y" into item 1 of line rCardi of field "Card Table"
  80.     set the castNum of sprite 8 to the number of cast "Match-on"
  81.     set matchedCount to matchedCount + 1
  82.     set rCard to EMPTY
  83.     set uCard to EMPTY
  84.     go("Match")
  85.   else
  86.     if whichCard < 5 then
  87.       turnCardBack("U")
  88.     else
  89.       turnCardBack("R")
  90.     end if
  91.     set the castNum of sprite 8 to the number of cast "Match-off"
  92.     go(the frame + 1)
  93.   end if
  94. end
  95.  
  96. on turnCardBack RorU
  97.   global rCard, rCardi, uCard, uCardi
  98.   if RorU = "R" then
  99.     if rCard <> EMPTY then
  100.       set rCard to EMPTY
  101.       set the castNum of sprite (rCardi + 8) to the number of cast "Card Back"
  102.       set the castNum of sprite 17 to the number of cast "Blank"
  103.     else
  104.       nothing()
  105.     end if
  106.   else
  107.     if uCard <> EMPTY then
  108.       set uCard to EMPTY
  109.       set the castNum of sprite (uCardi + 8) to the number of cast "Card Back"
  110.       set the castNum of sprite 18 to the number of cast "Blank"
  111.     else
  112.       nothing()
  113.     end if
  114.   end if
  115.   updateStage()
  116. end
  117.  
  118. on setUpText
  119.   global uCardi, rCardi, whichCard
  120.   if whichCard < 5 then
  121.     set the castNum of sprite 17 to the number of cast ("R" & item 2 of line rCardi of field "card Table")
  122.   else
  123.     set the castNum of sprite 18 to the number of cast ("U" & item 2 of line uCardi of field "card Table")
  124.   end if
  125.   setTextLoc()
  126. end
  127.  
  128. on setTextLoc
  129.   global whichCard
  130.   set x to line whichCard of field "Text Locations"
  131.   set i to value(item 1 of x)
  132.   set j to ((random(i) - 1) * 2) + 2
  133.   if whichCard < 5 then
  134.     set the locH of sprite 17 to 20 + value(item j of x)
  135.     set the locV of sprite 17 to 70 + value(item j + 1 of x)
  136.   else
  137.     set the locH of sprite 18 to 290 + value(item j of x)
  138.     set the locV of sprite 18 to 70 + value(item j + 1 of x)
  139.   end if
  140. end
  141.  
  142. on showGames
  143.   global gameCount
  144.   repeat with i = 9 to 16
  145.     set the ink of sprite i to 8
  146.   end repeat
  147.   updateStage()
  148.   set gameCount to gameCount + 1
  149.   set i to gameCount + 1
  150.   set the castNum of sprite i to the number of cast "Blank"
  151.   updateStage()
  152. end
  153.  
  154. on reverseCards
  155.   set i to 0
  156.   repeat while i < 8
  157.     set j to random(8) + 8
  158.     if the castNum of sprite j <> the number of cast "Card Back" then
  159.       set the castNum of sprite j to the number of cast "Card Back"
  160.       set the ink of sprite j to 8
  161.       set i to i + 1
  162.       puppetSound("Bones")
  163.       updateStage()
  164.     end if
  165.   end repeat
  166. end
  167.  
  168. on initGame
  169.   global matchedCount, rCard, uCard
  170.   repeat with i = 1 to 8
  171.     put " " into line i of field "Card Table"
  172.   end repeat
  173.   repeat with i = 1 to 4
  174.     set n to getCardNo()
  175.     placeCard("U", n)
  176.     placeCard("R", n)
  177.   end repeat
  178.   set rCard to EMPTY
  179.   set uCard to EMPTY
  180.   set matchedCount to 0
  181. end
  182.  
  183. on getCardNo
  184.   set found to 0
  185.   set i to random(24)
  186.   repeat while not found
  187.     if line i of field "Done LIst" = "N" then
  188.       set found to 1
  189.       next repeat
  190.     end if
  191.     if i = 24 then
  192.       set i to 1
  193.       next repeat
  194.     end if
  195.     set i to i + 1
  196.   end repeat
  197.   put "Y" into line i of field "Done List"
  198.   return i
  199. end
  200.  
  201. on placeCard side, cardNo
  202.   set done to 0
  203.   if side = "R" then
  204.     set j to 0
  205.   else
  206.     set j to 4
  207.   end if
  208.   repeat while not done
  209.     set i to random(4) + j
  210.     if item 1 of line i of field "Card Table" = " " then
  211.       put "N," & string(cardNo) & "," into line i of field "Card Table"
  212.       set done to 1
  213.       next repeat
  214.     end if
  215.     nothing()
  216.   end repeat
  217. end
  218.